/*
    XTU OJ: 1238
    by: fifth_light
*/

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int64_t mod = 1000000007;
int table[1000050];
int pow_table[1000050];

void prepare_table(void) {
    table[1] = 2;
    table[2] = 3;
    for (int i = 3; i < 1000050; i++) {
        table[i] = (table[i - 1] + table[i - 2]) % mod;
    }
    pow_table[0] = 1;
    for (int i = 1; i < 1000050; i++) {
        pow_table[i] = pow_table[i - 1] * 2 % mod;
    }
}

int64_t longPow(int power) {
    return pow_table[power];
}

int64_t roundBack(int64_t num) {
    if (num < 0) {
        return num + mod;
    } else {
        return num;
    }
}

int64_t func(int n) {
    return table[n];
}

int main(void) {
    prepare_table();
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        int num;
        scanf("%d", &num);
        printf("%" PRId64 "\n", roundBack(longPow(num) - func(num)));
    }
    return 0;
}
